home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11257 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  40 lines

  1. Path: eua.ericsson.se!usenet
  2. From: etxmide@eua.ericsson.se (Milan Desnica)
  3. Newsgroups: comp.lang.c++
  4. Subject: template instantiation
  5. Date: 13 Mar 1996 15:03:15 GMT
  6. Organization: Ericsson Telecom Systems Labs, Stockholm, Sweden
  7. Message-ID: <4i6o3j$e93@euas20.eua.ericsson.se>
  8. Reply-To: etxmide@eua.ericsson.se
  9. NNTP-Posting-Host: euas31i3c39.eua.ericsson.se
  10. NNTP-Posting-User: etxmide
  11.  
  12. I am have a list class and a Listiterator class, based on templates. To test the classes I use a simple main.c - file:     
  13. -----------------------
  14. #include "list.h"
  15. #include "listIterator.h"
  16.  
  17. main() {
  18.     List<int> myList;
  19.     Listiterator<int> myIterator(myList);
  20. }
  21. -----------------------
  22. Compiling these files goes successfully, however, when doing the same thing in the header file 'XXY.h':
  23. -----------------------
  24. #include "list.h"
  25. #include "listIterator.h"   // I have ommited trivial things 
  26.  
  27. class XXY {
  28.     List<int> myList;
  29.     Listiterator<int> myIterator(myList);
  30. };
  31. ----------------------    
  32.  
  33.  , the compiler complains at the Listiterator initialization. What is wrong? How will I instantiate and initialize a data member which is a template-class?
  34.  
  35.  
  36.    / Thanks
  37.             
  38.  
  39.  
  40.